package com.cesgroup.zw.spring.boot.library.echarts.line.complex;

import com.cesgroup.zw.spring.boot.echarts.build.EChartsOption;
import com.cesgroup.zw.spring.boot.echarts.component.Grid;
import com.cesgroup.zw.spring.boot.echarts.component.Title;
import com.cesgroup.zw.spring.boot.echarts.component.axis.XAxis;
import com.cesgroup.zw.spring.boot.echarts.component.axis.YAxis;
import com.cesgroup.zw.spring.boot.echarts.enums.Align;
import com.cesgroup.zw.spring.boot.echarts.enums.AxisType;
import com.cesgroup.zw.spring.boot.echarts.enums.Position;
import com.cesgroup.zw.spring.boot.echarts.model.axis.AxisLabel;
import com.cesgroup.zw.spring.boot.echarts.model.axis.AxisLine;
import com.cesgroup.zw.spring.boot.echarts.model.axis.AxisTick;
import com.cesgroup.zw.spring.boot.echarts.model.axis.SplitLine;
import com.cesgroup.zw.spring.boot.echarts.model.style.LineStyle;
import com.cesgroup.zw.spring.boot.echarts.model.style.RichTextStyle;

/**
 * <p>折线图</p>
 * @author ytj
 * @date 2019/7/8 17:04
 */
@SuppressWarnings("serial")
public class ComplexLineOption extends EChartsOption{
    public ComplexLineOption(ComplexLineParam param){
        this.setBackgroundColor("#06a7ff");
        this.setTitle(new Title(){{
            this.setText("OCTOBER 2015");
            this.setLeft(Align.center);
            this.setBottom("5%");
            this.setTextStyle(new RichTextStyle(){{
                this.setColor("#fff");
                this.setFontSize(16);
            }});
        }});
        this.setGrid(new Grid(){{
            this.setTop("20%");
            this.setLeft("10%");
            this.setRight("10%");
            this.setBottom("15%");
            this.setContainerLabel(true);
        }});
        this.setXAxis(new XAxis(){{
            this.setType(AxisType.category);
            this.setBoundaryGap(false);
            this.setAxisLabel(new AxisLabel(){{
                this.setMargin(30);
                this.setColor("#ffffff63");
            }});
            this.setAxisLine(new AxisLine(){{
                this.setShow(false);
            }});
            this.setAxisTick(new AxisTick(){{
                this.setShow(true);
                this.setLength(25);
                this.setLineStyle(new LineStyle(){{
                    this.setColor("#ffffff1f");
                }});
            }});
            this.setSplitLine(new SplitLine(){{
                this.setShow(true);
                this.setLineStyle(new LineStyle(){{
                    this.setColor("#ffffff1f");
                }});
            }});
            this.setData(param.getDataset().get("name"));
        }});
        this.setYAxis(new YAxis(){{
            this.setType(AxisType.value);
            this.setPosition(Position.right);
            this.setAxisLabel(new AxisLabel(){{
                this.setMargin(20);
                this.setColor("#ffffff63");
            }});
            this.setAxisTick(new AxisTick(){{
                this.setShow(true);
                this.setLength(15);
                this.setLineStyle(new LineStyle(){{
                    this.setColor("#ffffff1f");
                }});
            }});
            this.setSplitLine(new SplitLine(){{
                this.setShow(true);
                this.setLineStyle(new LineStyle(){{
                    this.setColor("#ffffff1f");
                }});
            }});
            this.setAxisLine(new AxisLine(){{
                this.setLineStyle(new LineStyle(){{
                    this.setColor("#fff");
                    this.setWidth(2);
                }});
            }});
        }});
    }
}
